/**
 * Copyright 2009 Adam Ruggles.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.code.sapien.interceptor;

import com.google.code.sapien.guice.transaction.Transactional;
import com.opensymphony.xwork2.ActionInvocation;
import com.opensymphony.xwork2.interceptor.Interceptor;

/**
 * Opens a Transaction/EntityManager Session for the view.
 * @author Adam
 * @version $Id: OpenSessionInViewInterceptor.java 16 2009-04-12 05:05:02Z a.ruggles $
 * 
 * Created on Feb 8, 2009 at 8:14:54 PM 
 */
public class OpenSessionInViewInterceptor implements Interceptor {
	/**
	 * Serial Version UID.
	 */
	private static final long serialVersionUID = 979896154524068869L;

	/**
	 * {@inheritDoc}
	 * @see com.opensymphony.xwork2.interceptor.Interceptor#destroy()
	 */
	public void destroy() {
		// Not implemented.
	}

	/**
	 * {@inheritDoc}
	 * @see com.opensymphony.xwork2.interceptor.Interceptor#init()
	 */
	public void init() {
		// Not implemented.
	}

	/**
	 * {@inheritDoc}
	 * @see com.opensymphony.xwork2.interceptor.Interceptor#intercept(com.opensymphony.xwork2.ActionInvocation)
	 */
	@Transactional
	public String intercept(final ActionInvocation invocation) throws Exception {
		return invocation.invoke();
	}

}
